package com.wonders.bigdata.dubborpc.customer;

import com.wonders.bigdata.dubborpc.netty.NettyClient;
import com.wonders.bigdata.dubborpc.publicinterface.HelloService;

/**
 * Description: <br>
 *
 * @author: XB
 * @date: 2022/2/8 16:12
 */
public class ClientBootstrap {
    /**
     * 这里定义协议头
     */
    public static final String providerName = "HelloService#hello#";

    public static void main(String[] args) throws InterruptedException {
        // 创建一个消费者
        NettyClient customer = new NettyClient();

        // 创建代理对象
        HelloService service = (HelloService) customer.getBean(HelloService.class, providerName);

        for (;;) {
            Thread.sleep(5*1000);
            // 通过代理兑现调用服务提供者的方法
            String res = service.hello("你好， dubbo~~");
            System.out.println("调用的结果 res = " + res);
        }
    }

}
